home *** CD-ROM | disk | FTP | other *** search
/ PC Graphics Unleashed / PC Graphics Unleashed.iso / ch17 / pi / roomfly / spotcalc.inc < prev    next >
Encoding:
Text File  |  1994-08-02  |  2.5 KB  |  52 lines

  1. // Polyray include file: SPOTCALC.INC
  2. // by Rob McGregor
  3.  
  4. /**************************************************************
  5.   Calculate the values for spotlight "at" vector (spot1)
  6. ***************************************************************/
  7.  
  8. define L1Px t3 * (-0.5 * L1n1x[key]) + t3 * (1.5 * L1n2x[key]) + t3 * 
  9.             (-1.5 * L1n3x[key]) + t3 * (0.5 * L1n4x[key]) + t2 * 
  10.             L1n1x[key] + t2 * (-2.5 * L1n2x[key]) + t2 * (2 * L1n3x[key]) + 
  11.             t2 * (-0.5 * L1n4x[key]) + t * (-0.5 * L1n1x[key]) + t * 
  12.             (0.5 * L1n3x[key]) + L1n2x[key]
  13.  
  14. define L1Py t3 * (-0.5 * L1n1y[key]) + t3 * (1.5 * L1n2y[key]) + t3 * 
  15.             (-1.5 * L1n3y[key]) + t3 * (0.5 * L1n4y[key]) + t2 * 
  16.             L1n1y[key] + t2 * (-2.5 * L1n2y[key]) + t2 * (2 * L1n3y[key]) + 
  17.             t2 * (-0.5 * L1n4y[key]) + t * (-0.5 * L1n1y[key]) + t * 
  18.             (0.5 * L1n3y[key]) + L1n2y[key]
  19.  
  20. define L1Pz t3 * (-0.5 * L1n1z[key]) + t3 * (1.5 * L1n2z[key]) + t3 * 
  21.             (-1.5 * L1n3z[key]) + t3 * (0.5 * L1n4z[key]) + t2 * 
  22.             L1n1z[key] + t2 * (-2.5 * L1n2z[key]) + t2 * (2 * L1n3z[key]) + 
  23.             t2 * (-0.5 * L1n4z[key]) + t * (-0.5 * L1n1z[key]) + t * 
  24.             (0.5 * L1n3z[key]) + L1n2z[key]
  25.  
  26. /**************************************************************
  27.   Calculate the values for spotlight "at" vector (spot1)
  28. ***************************************************************/
  29.  
  30. define L2Px t3 * (-0.5 * L2n1x[key]) + t3 * (1.5 * L2n2x[key]) + t3 * 
  31.             (-1.5 * L2n3x[key]) + t3 * (0.5 * L2n4x[key]) + t2 * 
  32.             L2n1x[key] + t2 * (-2.5 * L2n2x[key]) + t2 * (2 * L2n3x[key]) + 
  33.             t2 * (-0.5 * L2n4x[key]) + t * (-0.5 * L2n1x[key]) + t * 
  34.             (0.5 * L2n3x[key]) + L2n2x[key]
  35.  
  36. define L2Py t3 * (-0.5 * L2n1y[key]) + t3 * (1.5 * L2n2y[key]) + t3 * 
  37.             (-1.5 * L2n3y[key]) + t3 * (0.5 * L2n4y[key]) + t2 * 
  38.             L2n1y[key] + t2 * (-2.5 * L2n2y[key]) + t2 * (2 * L2n3y[key]) + 
  39.             t2 * (-0.5 * L2n4y[key]) + t * (-0.5 * L2n1y[key]) + t * 
  40.             (0.5 * L2n3y[key]) + L2n2y[key]
  41.  
  42.  
  43. define L2Pz t3 * (-0.5 * L2n1z[key]) + t3 * (1.5 * L2n2z[key]) + t3 * 
  44.             (-1.5 * L2n3z[key]) + t3 * (0.5 * L2n4z[key]) + t2 * 
  45.             L2n1z[key] + t2 * (-2.5 * L2n2z[key]) + t2 * (2 * L2n3z[key]) + 
  46.             t2 * (-0.5 * L2n4z[key]) + t * (-0.5 * L2n1z[key]) + t * 
  47.             (0.5 * L2n3z[key]) + L2n2z[key]
  48.  
  49. // Now move the lights
  50. spot_light white, <2, 5, -1>, <L1Px, L1Py, L1Pz>, 1.85, 15, 25
  51. spot_light white, <2, 5, -1>, <L2Px, L2Py, L2Pz>, 1.85, 15, 25
  52.